package com.shycloud.mido.member.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shycloud.mido.member.api.dto.MemberOrderDTO;
import com.shycloud.mido.member.api.dto.PointsInfoDTO;
import com.shycloud.mido.member.api.entity.MemberOrder;
import com.shycloud.mido.member.api.vo.MemberOrderVO;
import com.shycloud.mido.member.api.vo.PayDepositVO;
import com.shycloud.mido.member.api.vo.PayHardwareDepositResultVO;
import com.shycloud.mido.member.api.vo.PayHistoryVORep;
import com.shycloud.mido.opter.api.entity.StockSaleOrder;
import java.util.List;
import org.apache.ibatis.annotations.Param;

/**
 * 会员订单管理
 *
 * @author lxy
 * @date 2019-05-20
 */
public interface MemberOrderMapper extends BaseMapper<MemberOrder> {

	/**
	 * 更新订单
	 *
	 * @param memberOrder 订单实体
	 */
	void updOrder(@Param("memberOrder") MemberOrder memberOrder);

	/**
	 * 我的订单详情
	 *
	 * @param orderNo 订单编号
	 * @return R<OrderListVO>
	 */
	MemberOrderVO orderInfo(@Param("orderNo") String orderNo);

	/**
	 * 生成会员订单
	 *
	 * @param memberOrder 会员订单实体
	 * @return
	 */
	boolean memberOrder(@Param("memberOrder") MemberOrder memberOrder);

	/**
	 * 曲集购买
	 *
	 * @param collectionId
	 * @return java.lang.Integer
	 * @author nianhua.jiang
	 * @date 2020/8/10 15:25
	 */
	Integer payCollection(@Param("collectionId") Integer collectionId);

	/**
	 * 追加会员购买曲集记录表
	 *
	 * @param id
	 * @param collectionId
	 * @return java.lang.Integer
	 * @author nianhua.jiang
	 * @date 2020/8/10 16:25
	 */
	boolean insertMemberBuyCollection(@Param("memberId") String id, @Param("collectionId") Integer collectionId,
			@Param("type") String type, @Param("isShow") String isShow);

	/**
	 * 校验用户是否购买过该曲集
	 *
	 * @param id
	 * @param collectionId
	 * @return java.lang.Integer
	 * @author nianhua.jiang
	 * @date 2020/8/10 17:02
	 */
	Integer checkIsByCollection(@Param("id") String id, @Param("collectionId") Integer collectionId);


	IPage<MemberOrderVO> pageOrders(@Param("page") Page page
			, @Param("orderType") String orderType
			, @Param("startDate") String startDate
			, @Param("endDate") String endDate
			, @Param("paymentMethod") String paymentMethod
			, @Param("orderNo") Long orderNo
			, @Param("status") String status
			, @Param("optId") Integer optId
			, @Param("orgId") Integer orgId);

	IPage<PayHistoryVORep> getPayHistoryList(@Param("page") Page page,
			@Param("username") String username,
			@Param("payMethod") String payMethod,
			@Param("orderType") String orderType,
			@Param("status") String status,
			@Param("startTime") String startTime,
			@Param("endTime") String endTime);

	IPage<PayHistoryVORep> getPayHistoryListDeposit(@Param("page") Page page,
			@Param("orderNo") String orderNo,
			@Param("fuwuOrderNo") String fuwuOrderNo,
			@Param("payMethod") String payMethod,
			@Param("orderType") String orderType,
			@Param("status") String status);

	StockSaleOrder getStockSaleByOrderNo(@Param("relationOrderNo") String relationOrderNo);

	List<PayDepositVO> getPayDepositNonList(@Param("orgId") Integer orgId, @Param("status") String status);

	int getPayDepositNonCount(@Param("orgId") Integer orgId, @Param("status") String status);

	List<PayDepositVO> getPayDepositList(@Param("orgId") Integer orgId);

	PayHardwareDepositResultVO getPayHardwareDepositResult(@Param("orderNo") String orderNo);
}
